package com.cwl.pattern.访问者模式;

/**
 * @program: pattern
 * @description: 测试用例
 * @author: ChenWenLong
 * @create: 2019-07-10 11:41
 **/
public class VisitorPattern {

    public static void main(String[] args) {
        ObjectStructure os=new ObjectStructure();
        os.add(new ConcreteElementA());
        os.add(new ConcreteElementB());
        Visitor visitor=new ConcreteVisitorA();
        os.accept(visitor);
        System.out.println("------------------------");
        visitor=new ConcreteVisitorB();
        os.accept(visitor);
    }
}
